var WxParse = require('../../wxParse/wxParse.js');
const app = getApp()
Page({
  data:{
    resourceUrl: app.globalData.apiUrl + '/public/uploads/goods/',
    goods: {
      id: 1,
      image: '/image/1.jpg',
      title: '马什么梅?',
      detail: '想看你哭想看你笑想把你拥入怀抱想看你哭想看你笑想把你拥入怀抱想看你哭想看你笑想把你拥入怀抱想看你哭想看你笑想把你拥入怀抱想看你哭想看你笑想把你拥入怀抱想看你哭想看你笑想把你拥入怀抱想看你哭想看你笑想把你拥入怀抱',
      parameter: '125g/个',
      service: '不支持退货'
    },
    curIndex: 0,
    img: [{ "img": "/../image/1.jpg" }],
  },
  onLoad:function (options){
      var that = this;
      console.log(options)
      wx.request({
        url: app.globalData.apiUrl+'/api/goods/integralInfo',
        data:{id:options.id},
        method: 'GET',
        dataType: 'json',
        success: function(res) {
          console.log(res.data)
          //富文本
          WxParse.wxParse('content', 'html', res.data.content, that, 0);
          that.setData({ goods: res.data })
        },
        fail: function(res) {},
        complete: function(res) {},
      })
  },
  bindTap(e) {
    const index = parseInt(e.currentTarget.dataset.index);
    this.setData({
      curIndex: index
    })
  },
})